<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/10/24 0024
 * Time: 下午 5:09
 */
namespace app\article\controller\memarticle;
use app\article\model\Mem;
use app\article\validate\ValidateFun;
use app\article\validate\ValiMem;
use app\common\api\article\IMemarticle;

class Memarticle implements IMemarticle{
    private $data=[];

    /**
     * 初始化参数
     * Memarticle constructor.
     * @param array $config
     */
    public function __construct(array $config=[])
    {
        $this->data = array_filter_full(array_merge($this->data,$config));
    }

    /**
     * 左侧栏全部信息
     * @return array|void
     */
    public function mem_article()
    {
        $data = $this->data;
        #验证参数
        $vali =ValiMem::Mem_info();
        $validate = new ValidateFun($vali['rule'],$vali['message']);
        if (!$validate->check($data)){
            return ['code'=>$validate->getError(),'msg'=>config("msg".$validate->getError())];
        }
        #获取
        $info = new Mem();
        $res = $info->mem_info($data);
        #返回

        return $res;
    }
}